<?php
header("Content-type: application/json; charset=UTF-8");
include_once "service.php";
$service = new Dcservice();
$json = json_decode(file_get_contents("php://input"));

$result = ['code' => 0, 'msg' => '添加成功！'];
try {
    $service->addDishType($json->type_name);
} catch (Error $error) {
    $result=['code'=>-1,'msg'=>$error->getMessage()];
}

echo json_encode($result);